Update uninstall commands for Az.Accounts#206
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR improves the Az.Accounts module version management instructions by replacing a simple uninstall command with a more sophisticated script that selectively removes unwanted versions while preserving or installing the required version (4.0.2).
Key Changes:
- Replaced simple
Uninstall-Module az.accounts -allversionswith a multi-step PowerShell script - Added logic to uninstall only non-required versions of Az.Accounts
- Included verification steps to list installed versions before and after the operation
| Get-InstalledModule -Name $RequiredModuleName -AllVersions | ||
|
|
||
| #Uninstall all but the required version | ||
| Get-InstalledModule -Name $RequiredModuleName -AllVersions | Where-Object { $_.Version -ne $RequiredModuleVersion } | ForEach-Object { Uninstall-Module -Name $RequiredModuleName -RequiredVersion $_.Version -Force } |
There was a problem hiding this comment.
The -Force parameter on Uninstall-Module is potentially unsafe for production environments as it suppresses all prompts and warnings. Consider removing -Force to allow users to review what will be uninstalled, or add defensive checks before uninstalling (e.g., verify which versions will be removed). Additionally, this complex one-liner lacks error handling - consider using $ErrorActionPreference = "Stop" at the beginning of the script or adding try-catch blocks to handle potential failures gracefully.
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
TSG/EnvironmentValidator/Troubleshooting-MSI-Does-Not-Have-Access-To-Subscription.md
Show resolved
Hide resolved
TSG/EnvironmentValidator/Troubleshooting-MSI-Does-Not-Have-Access-To-Subscription.md
Outdated
Show resolved
Hide resolved
TSG/EnvironmentValidator/Troubleshooting-MSI-Does-Not-Have-Access-To-Subscription.md
Outdated
Show resolved
Hide resolved
TSG/EnvironmentValidator/Troubleshooting-MSI-Does-Not-Have-Access-To-Subscription.md
Outdated
Show resolved
Hide resolved
|
@erskinejohn I've opened a new pull request, #216, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@erskinejohn I've opened a new pull request, #217, to work on those changes. Once the pull request is ready, I'll request review from you. |
…ess-To-Subscription.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ess-To-Subscription.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ess-To-Subscription.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
[WIP] Update uninstall commands based on feedback for Az.Accounts
[WIP] WIP address feedback on uninstall commands for Az.Accounts update
No description provided.